Only handle exposes on native window, propagate to children via draw()
authorAlexander Larsson <alexl@redhat.com>
Wed, 17 Apr 2013 18:55:26 +0000 (20:55 +0200)
committerAlexander Larsson <alexl@redhat.com>
Tue, 7 May 2013 14:33:01 +0000 (16:33 +0200)
commitd22fd7223c75f4720ddb982c659efb0d8d7543c4
tree6c215ea16969c85cbbdcbccda304cd4cdf9d3e74
parentfc645f2865344a5f481ceed1e90deb23f3f02f31
Only handle exposes on native window, propagate to children via draw()

We now consider non-native windows non-opaque, which means any invalid
area in a subwindow will also be invalid all the way up to the nearest
native windows. We take advantage of this by ignoring all expose events
on non-native windows (which typically means just the toplevel) and instead
propagating down the draw() calls to children directly via
gtk_container_propagate_draw.

This is nice as it means we always draw widgets the same way, and it
will let us do some interesting ways in the future.

We also clean up the GtkWidget opacity handling as we can now always
rely on the draing happening via cairo.

We can't really just draw by walking down the widget hierarchy, as
this doesn't get the clipping right (so e.g. widgets doing cairo_paint
may draw outside the expected gdkwindow subarea) nor does it let
us paint window backgrounds.

So, we now do multiple draws for each widget, once for each GdkWindow,
although we still do it on the same base cairo_t that we get for the
toplevel native window. The difference is only the clipping, the rendering
order, and which other widgets we propagate into.

We also collect all the windows of a widget so we can expose them inside
the same opacity group if needed.

NOTE: This change neuters gtk_widget_set_double_buffered for
widgets without native windows. Its impossible to disable
the double buffering in this model.
gdk/gdkwindow.c
gtk/gtkcontainer.c
gtk/gtkmain.c
gtk/gtkwidget.c
gtk/gtkwidgetprivate.h